---
title: JSON.encode()
api: JSON.encode
---

## Description

<Summary/>

This method returns a [Data](/reference/api/Data) for the formatted text. When a string is needed, use [JSON.stringify()](/reference/api/JSON/stringify) instead, which could be a bit lower in performance.

## Syntax

``` js
JSON.encode(value)
```

## Parameters

<Parameters/>

## See Also

* [JSON](/reference/api/JSON)
* [stringify()](/reference/api/JSON/stringify)
* [decode()](/reference/api/JSON/decode)
